<template>
  <div class="ultrasonic flex-y-start-stretch pt-40">
    <SecondHeader :title="'超声影像'"></SecondHeader>
    <div class="dcm pt-5">
      <Dicom :file="d1"></Dicom>
    </div>
    <div class="dataBox flex-x-between">
      <div class="item" :class="{ warn: index == 0 }" v-for="(item, index) in dataList" :key="index">
        <div class="label">{{ item.label }}</div>
        <div class="value">{{ item.key }}</div>
        <div class="unit">{{ item.unit }}</div>
      </div>
    </div>
    <div class="infusion flex-y-start-stretch err">
      <div class="titleBox">
        <div class="status">异常</div>
        输液信息
      </div>
      <div class="list flex-x-between flex-wrap">
        <div class="item" :class="{ err: index == 3 }" v-for="(item, index) in list" :key="index">
          <div class="value">
            {{ item.key }}<span class="unit mr-12">{{ item.unit }}</span>
          </div>
          <div class="label">{{ item.label }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
import SecondHeader from "@/components/SecondHeader/index.vue";
import Dicom from "@/components/Dicom/detail.vue";
let d1 = ref<File>();
onMounted(() => {
  fetch("./1.2.840.113619.2.391.61490.1694724847.21.1.512.dcm")
    .then(response => response.blob())
    .then(blob => {
      let file = new File([blob], "fileName", { type: "dcm" });
      d1.value = file;
    })
    .catch(err => {
      console.log("err:", err);
    });
});
interface signsList {
  label?: string;
  key?: string;
  unit?: string;
}
const dataList = ref<signsList[]>([
  {
    label: "羊水量",
    key: "15",
    unit: "mm"
  },
  {
    label: "脐带血流指数",
    key: "12",
    unit: "cm/s"
  },
  {
    label: "胚芽",
    key: "5",
    unit: "ETU"
  }
]);
interface infusionList {
  label?: string;
  key?: string;
  unit?: string;
}
const list = ref<infusionList[]>([
  {
    label: "流速",
    key: "5",
    unit: "d/min"
  },
  {
    label: "输注时间",
    key: "15",
    unit: "min"
  },
  {
    label: "剩余时间",
    key: "26",
    unit: "min"
  },
  {
    label: "预设量",
    key: "100",
    unit: "ml"
  },
  {
    label: "输注量",
    key: "23",
    unit: "ml"
  },
  {
    label: "剩余量",
    key: "77",
    unit: "ml "
  },
  {
    label: "输注压力",
    key: "16",
    unit: "pa "
  },
  {
    label: "输注模式",
    key: "体重模式",
    unit: ""
  }
]);
</script>

<style lang="scss" scoped>
.dcm {
  width: 100%;
  flex: 1;
  height: 0;
}
.infusion {
  height: 235px;
  border: 1px solid #ffffff;
  box-sizing: border-box;
  box-shadow: inset 0px 4px 10px 0px rgba(0, 0, 0, 0.3);
  padding: 10px;
  &.err {
    border: 1px solid #e20505;
    box-shadow: inset 0px 4px 10px 0px rgba(0, 0, 0, 0.3);
    .status {
      background-image: url("../../../assets/images/rescue/errBut.png") !important;
    }
  }
  .list {
    flex: 1;
    height: 0;
    .item {
      width: calc((100% - 1px) / 4);
      text-align: center;
      line-height: 30px;
      .value {
        font-size: 30px;
        color: #51b9ff;
        height: 30px;
        font-weight: bold;
        .unit {
          font-size: 16px;
          font-weight: 400;
        }
      }
      &:last-child {
        .value {
          font-size: 20px;
          line-height: 35px;
        }
      }
      .label {
        height: 30px;
        font-size: 16px;
        color: #ffffff;
      }
      &.err {
        .value {
          color: #e20505;
        }
        .label {
          color: #e20505;
        }
      }
    }
  }
  .titleBox {
    line-height: 40px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 18px;
    color: #ffffff;
    position: relative;
    .status {
      position: absolute;
      width: 62px;
      height: 26px;
      font-size: 14px;
      font-weight: bold;
      line-height: 26px;
      text-align: center;
      background-image: url("../../assets/images/rescue/but.png");
      background-position: center;
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
  }
}
.dataBox {
  margin: 15px 0;
  .item {
    width: 147px;
    height: 74px;
    box-sizing: border-box;
    border-image: linear-gradient(0deg, #127baa, #119edb) 10 10;
    background: linear-gradient(0deg, rgba(0, 188, 254, 0.46) 39%, rgba(0, 255, 247, 0) 69%);
    border: 1px solid #119edb;
    border-radius: 10px;
    &.warn {
      border-image: linear-gradient(0deg, #db0101, #ec1a1a) 10 10;
      background: linear-gradient(0deg, rgba(230, 0, 0, 0.7) 39%, rgba(255, 0, 0, 0) 69%);
      border: 1px solid rgb(189, 49, 36);
    }
    .label {
      text-align: center;
      color: #ffffff;
      font-size: 14px;
      margin-top: 5px;
    }
    .value {
      font-size: 20px;
      color: #ffffff;
      text-align: center;
    }
    .unit {
      font-size: 14px;
      color: #ffffff;
      text-align: right;
      margin-right: 12px;
    }
  }
}
.ultrasonic {
  width: 475px;
  margin-left: 10px;
}
</style>
